<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: Hedge.js</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Source: Hedge.js</h1>

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>// half edge angle
function hangle(dx, dy) {
    var l = Math.sqrt(dx * dx + dy * dy);

    if (dy > 0) {
        return Math.acos(dx / l);
    } else {
        return 2 * Math.PI - Math.acos(dx / l);
    }
}

var counter = 0;

/**
 * Half Edge
 * Don't instantiate this class in your code.
 * it can only be called by the {@link DCEL} class.
 * @class
 * @param {Vertex} v1 
 * @param {Vertex} v2 
 */
function Hedge(v1, v2) {
    this.id = counter++;
    this.origin = v2;
    this.twin = null;
    this.face = null;
    this.nexthedge = null;
    this.angle = hangle(v2.x - v1.x, v2.y - v1.y);
    this.prevhedge = null;
    this.length = Math.sqrt(Math.pow(v2.x - v1.x, 2) + Math.pow(v2.y - v1.y, 2));
}

Object.assign(Hedge.prototype, {

    dispose: function() {
        this.origin = null;
        this.twin = null;
        this.face = null;
        this.nexthedge = null;
        this.prevhedge = null;
    }

});

export {Hedge};</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AABB.html">AABB</a></li><li><a href="DCEL.html">DCEL</a></li><li><a href="Face.html">Face</a></li><li><a href="Hedge.html">Hedge</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Aug 27 2018 23:03:48 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
